package com.atguigu.service.impl;

import com.atguigu.base.BaseMapper;
import com.atguigu.base.BaseServiceImpl;
import com.atguigu.entity.Community;
import com.atguigu.mapper.CommunityMapper;
import com.atguigu.mapper.DictMapper;
import com.atguigu.service.CommunityService;
import com.atguigu.service.DictService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Author:hx
 * @DateTime:2022/9/26 20:17
 * @Description:
 */
@DubboService
public class CommunityServiceImpl extends BaseServiceImpl<Community> implements CommunityService {
    @Autowired
    private CommunityMapper communityMapper;
    @Autowired
    private DictMapper dictMapper;

    @Override
    public BaseMapper<Community> getBaseMapper() {
        return communityMapper;
    }

    @Override
    public Community getById(Long id) {
        Community community = communityMapper.getById(id);
        community.setAreaName(dictMapper.getNameById(community.getAreaId()));
        community.setPlateName(dictMapper.getNameById(community.getPlateId()));
        return community;
    }
}
